package com.management.service.Impl;

import com.management.dao.CommodityDao;
import com.management.po.Commodity;
import com.management.service.CommodityService;
import com.management.vo.CommodityVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @version v1.0
 * @Author: Slark
 * @Date: Created in2021/10/29  18:52
 * 商品业务逻辑接口实现类
 */
@Service
public class CommodityServiceImpl implements CommodityService {

    @Autowired
    CommodityDao commodityDao;


    @Override
    public List<CommodityVO> findAll() {
        return commodityDao.findAll();
    }

    @Override
    public CommodityVO findById(int commodityId) {
        return commodityDao.findById(commodityId);
    }

    @Override
    public boolean add(Commodity commodity) {

        return commodityDao.add(commodity)>0?true:false;
    }

    @Override
    public boolean update(Commodity commodity) {
        return commodityDao.update(commodity)>0?true:false;
    }

    @Override
    public List<CommodityVO> findByCompanyId(int companyId) {
        return commodityDao.findByCompanyId(companyId);
    }

    @Override
    public List<CommodityVO> findByCommodityTypeId(int commodityTypeId) {
        return commodityDao.findByCommodityTypeId(commodityTypeId);
    }

    @Override
    public List<CommodityVO> find(Commodity commodity) {
        return commodityDao.find(commodity);
    }
}
